package com.budwk.app.sqfwV2.service.centuryCity;

import com.alibaba.fastjson.JSONObject;
import com.budwk.app.sqfw.constants.SqfwFormSummaryConstants;
import com.budwk.app.sqfw.constants.SqfwWebSocketMsgConstants;
import com.budwk.app.sqfw.enums.DownLoadFileNameEnum;
import com.budwk.app.sqfw.models.Sqfw_completeflow;
import com.budwk.app.sqfw.models.Sqfw_formSummary_new;
import com.budwk.app.sqfwDoc.codeGenerator.impl.SqfwTemplatePdfCommonService;
import com.budwk.app.sqfwDoc.codeGenerator.pdfGenerate.AbstractCustomerPdfCreateField;

import com.budwk.app.sqfwDoc.codeGenerator.pdfGenerate.BaseTemplatePdfGenerator;
import com.budwk.app.sqfwDoc.codeGenerator.pdfGenerate.SqfwPdfCreateCommonBO;
import com.budwk.app.sqfwV2.dto.dto.OldCareServiceStationPdfDTO;
import com.budwk.app.sqfwV2.generator.centuryCity.CenturyCityOldCareServicePatrolPdfGenerator;
import com.google.common.collect.Lists;
import org.nutz.ioc.loader.annotation.IocBean;

import java.util.List;

/**
 * 本代码由代码生成器生成，版本号1.0
 */
@IocBean
public class OldCareServiceStationPdfService extends SqfwTemplatePdfCommonService {

    @Override
    public AbstractCustomerPdfCreateField getPdfCreateField(Sqfw_formSummary_new formSummary) {
        return JSONObject.parseObject(formSummary.getParamData(), OldCareServiceStationPdfDTO.class);
    }

    /**
     * 第五张表中的需要的类型，详情见 {@link SqfwFormSummaryConstants}
     *
     * @return 返回数据
     */
    @Override
    public String getSummaryType() {
        return SqfwFormSummaryConstants.old_care_service_patrol;
    }

    /**
     * 当pdf生成成功的时候，sock发送什么样的消息至前端
     * 参照{@link SqfwWebSocketMsgConstants}
     *
     * @return 结果
     */
    @Override
    public String getPdfCreateSocketType() {
        return SqfwWebSocketMsgConstants.work_flow_pdf_created;
    }

    /**
     * 创建下载文件的名称
     * 可以参照 {@link com.budwk.app.sqfw.enums.DownLoadFileNameEnum}
     * 注意！！！ 不用加上.pdf或者.word后缀
     *
     * @param completeFlow   工作流
     * @param formSummaryNew 表单数据
     * @return 结果
     */
    @Override
    protected String getDownloadFileName(Sqfw_completeflow completeFlow, Sqfw_formSummary_new formSummaryNew) {
        return DownLoadFileNameEnum.OLD_CARE_SERVICE_PATROL_PDF.getName();
    }

    @Override
    protected List<BaseTemplatePdfGenerator> getPdfGenerator(Sqfw_completeflow completeFlow, Sqfw_formSummary_new formSummary) {
        List<BaseTemplatePdfGenerator> generatorList = Lists.newArrayList();
        generatorList.add(new CenturyCityOldCareServicePatrolPdfGenerator());
        // 在这里添加自己的generator
        return generatorList;
    }

    @Override
    public void customerPopularPdfCreateParam(SqfwPdfCreateCommonBO pdfCreateCommonBO, Sqfw_completeflow completeFlow, Sqfw_formSummary_new formSummary) {

    }
}
